<%@page import="com.tiantian.domain.Businessstore"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE>
<html>
<head>
<style type="text/css">
.update {
	font-size: 12px;
	padding-left: 15px;
	color: #0033FF;
}
</style>
<script src="<c:url value='/static/jquery/jquery-1.9.1.min.js'/>"
	type="text/javascript"></script>
<script type="text/javascript"
	src="<c:url value='/static/common/uc_message.js'/>"></script>
<!-- validate -->
<link rel="stylesheet" href="<c:url value='/static/themes/bootstrap/bootstrapValidator.min.css'/>"/>
<script type="text/javascript" src="<c:url value='/static/themes/bootstrap/bootstrapValidator.min.js'/>"></script>
<title>申述进程</title>
</head>
<body>
	<div class="col-lg-12">
		<div id="message"></div>
		<div class="panel panel-default bk-bg-white">
			<div class="panel-heading bk-bg-white">
				<h4>
					<span style="font-size: 14px;color:red; padding-left: 30px">
						${compaints.userRoles=='0'?'买手发起的申述':'商家发起的申述' }
					</span>
				</h4>
			</div>
			<div class="panel-body">
				<div class="form-group col-sm-12">
					<div class="col-sm-12">
							<div class="row">
								<div class="form-group col-sm-4">
									<fmt:formatDate value="${compaints.appealsTime}"
											pattern="yyyy-MM-dd HH:mm:ss" />
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-4">
									<label class="col-sm-5 control-label">投诉内容&nbsp;:</label>
									<div class="col-sm-7" >${compaints.appealsDescription}</div>
								</div>
							</div>
							<div class="row">
								<div class="form-group col-sm-4">
									<c:forEach items="${pics}" var="pic">
										<img alt="" src="<c:url value='${pic.appealspic }'/>" width="100" height="100" />
									</c:forEach>
								</div>
							</div>
					</div>
				</div>
				
				
				<div class="form-group col-sm-12">
					<c:forEach items="${compaintsInfo }" var="info" varStatus="index">
						
						<div class="col-sm-12">
								<div class="row">
									<hr style="border:1;background-color:#f0f0f0;height:1px;"/>
									<div class="form-group col-sm-4">
										<fmt:formatDate value="${info.sentime}"
												pattern="yyyy-MM-dd HH:mm:ss" />
									</div>
								</div>
								<div class="row">
									<div class="form-group col-sm-12">
										<label class="col-sm-2 control-label">
											<c:choose>
												<c:when test="${compaints.sponsor==info.senduserid }">
													<c:set value="申述人" var="sponsor"/>
												</c:when>
												<c:when test="${compaints.otherUsers==info.senduserid }">
													<c:set value="被申述人" var="sponsor"/>
												</c:when>
											</c:choose>
											
											<c:choose>
												<c:when test="${info.sendusertype=='1' }">
													<span style="color: #FFB253">${sponsor }（商家）：</span>
												</c:when>
												<c:when test="${info.sendusertype=='2' }">
													<span style="color: #FFB253">${sponsor }（用户）：</span>
												</c:when>
												<c:when test="${info.sendusertype=='3' }">
													<span style="color: #428bca">平台客服：</span>
												</c:when>
											</c:choose>
										</label>
										<div class="col-sm-7" >${info.textcontent}</div>
									</div>
								</div>
						</div>
					
					</c:forEach>
			</div>
			
			<div class="form-group col-sm-12">
					<div class="col-sm-12">
							<div class="row">
								<div class="form-group">
										<input type="hidden" id="orderWhisperInfoID" value="${ship.whisperRelationsId }"/>
										<label class="col-sm-8 control-label">
											<textarea id="textContent" name=""textContent"" 
											class="form-control" placeholder="最多输入200字内容"
											data-plugin-markdown-editor="" rows="10"></textarea>
										</label>
								</div>
							</div>
							<div class="row">
								<div class="form-group">
										<div class="form-group " style="text-align: center;">
											<button type="button" id="save" class="btn btn-warning btn-sm"
												style="width: 150px">提交回复</button> 
											<button type="button" id="unsave" class="btn btn-default btn-sm"
												style="width: 150px">返回</button>
										</div>
								</div>
							</div>
					</div>
			</div>
			
		</div>
		
	</div>
	<script type="text/javascript">
		$(function($) {
			//保存
			$('#save').click(function() {
				var textContent = $("#textContent").val();
				if(!textContent){
					showmessage("请填写回复内容！");
					return;
				}else if(textContent.length>200){
					showmessage("回复内容超长！");
					return;
				}
				$.ajax({
					type : "post",
					url : path  + "/complaints/saveComplaintsInfo",
					cache : false,
					data : {
						complaintsId:"${param.complaintsId}",
						textContent : textContent,
						orderWhisperInfoID : $("#orderWhisperInfoID").val(),
						_t : new Date().getTime()
					},
					dataType : "json",
					success : function(data) {
						if (data.success) {
							$('#access').off("click");
							showmessage(data.msg,function(){
								window.location.reload(); 
							});
						}else{
							showmessage(data.msg);
						}
					}
				});
			});
			//取消
			$('#unsave').click(function() {
				window.location.href = history.go(-1);
			});

			
			
			//显示消息
			function showmessage(msg, callback, msgId) {
				if (msgId) {
					$('#' + msgId).ucMessage({
						msg : msg,
						callback : callback
					});
				} else {

					$('#message').ucMessage({
						msg : msg,
						callback : callback
					});
				}
			}
		});
	</script>
</body>

</html>